/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gray.fx.button;

import gray.Frame;
import util.observer.Trigger;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Button;

/**
 *
 * @author martin
 */
public class BButton extends Button implements Frame<Node>, EventHandler<ActionEvent>{
  private final Trigger _observer;
  private final Object _msg;
  
  private BButton(final String name, final Trigger observer, final Object msg){
    super();
    setText(name);
    //setColor
    if (observer != null)
      setOnAction(this);
    _observer=observer;
    _msg=msg;
  }

  @Override
  public Node container() {
    return this;
  }

  @Override
  public Boolean ready() {
    return true;
  }

  @Override
  public void handle(ActionEvent t) {
    _observer.poke(_msg);
  }
  
}
